package kr.hkit.powerjava.chapter12.Programming;

public class Person implements Comparable<Person> {

	private String name;
	private double height;
	
	public Person() {
	}

	
	public Person(String name) {
		this.name = name;
	}


	public Person(String name, double height) {
		this.name = name;
		this.height = height;
	}

	public void setPerson(String name, double height){
		this.name = name;
		this.height = height;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

	@Override
	public String toString() {
		return String.format("Person [name=%s, height=%s]", name, height);
	}
/*
	@Override
	public int compareTo(Person o) {
		return (int) (height*100 - o.height*100);
	}
*/
	
	@Override
	public int compareTo(Person o) {
		return this.name.hashCode() - o.name.hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		return name.equals(((Person)obj).name);
	}


	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return name.hashCode();
	}
	
	

}
